package org.dairy.farms.nandana.web.controller;

import org.dairy.farms.model.Livestock;
import org.dairy.farms.nandana.core.logic.ReportsManagementLogic;
import org.dairy.farms.nandana.core.logic.ReportsManagementLogicImpl;
import org.dairy.farms.nandana.web.view.LivestockExpenseToRevenueView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: gduggirala
 * Date: 1/3/13
 * Time: 12:49 PM
 */
@Controller
public class ReportsController {
    private static final Logger logger = LoggerFactory.getLogger(ReportsController.class);

    @Autowired
    ReportsManagementLogic reportsManagementLogic;

    @RequestMapping(value = "livestock/reports/expenseToRevenueReport.json", method = RequestMethod.GET)
    public void getExpenseToRevenueReport(@RequestParam(value = "id", required = true) Long livestockId, Model model) {
        List<LivestockExpenseToRevenueView> livestockExpenseToRevenueViewList = reportsManagementLogic.getExpenseToRevenueReport(livestockId);
        model.addAttribute("livestockExpenseToRevenueViewList", livestockExpenseToRevenueViewList);
        model.addAttribute("total", livestockExpenseToRevenueViewList.size());
    }

    @RequestMapping(value = "livestock/reports/livestocksDueForVaccination.json", method = RequestMethod.GET)
    public void getLivestocksDueForVaccination(Model model) {
     //   List<Livestock> livestockList = reportsManagementLogic.getLivestocksDueForVaccination();
    }
}
